﻿using FlexFlow.Base.Interface;
using FlexFlow.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FlexFlow.Base.Interface
{
    /// <summary>
    /// 为工作流任务提供者提供接口
    /// </summary>
    public interface IWorkFlowTaskProvider : IPhysicalEntityProvider<WorkFlowTask>
    {
        /// <summary>
        /// 取得指定用户发送的任务列表
        /// </summary>
        /// <param name="sender">发送者</param>
        /// <returns>
        /// 任务列表
        /// </returns>
        List<WorkFlowTask> GetTaskBySender(Guid sender);
        /// <summary>
        /// 取得发送给指定用户的任务列表
        /// </summary>
        /// <param name="reciver">任务的接收者</param>
        /// <returns>
        /// 任务列表
        /// </returns>
        List<WorkFlowTask> GetTaskByReciver(Guid reciver);
        /// <summary>
        /// 更新指定任务的状态以及消息
        /// </summary>
        /// <param name="identity">
        /// 任务ID
        /// </param>
        /// <param name="state">
        /// 任务状态
        /// </param>
        /// <param name="message">
        /// 任务消息
        /// </param>
        /// <returns>
        /// 一个值，表示操作是否成功
        /// </returns>
        bool UpdateState(Guid identity, WorkFlowTaskState state, string message = "");
        /// <summary>
        /// 更新指定任务的状态为已打开并且更新打开人员
        /// </summary>
        /// <param name="identity">任务标志</param>
        /// <param name="opener">打开人员</param>
        /// <returns>操作结果</returns>
        bool UpdateStateAndOpener(Guid identity, Guid opener);
        /// <summary>
        /// 更新指定任务的提交数据
        /// </summary>
        /// <param name="identity">
        /// 任务Id
        /// </param>
        /// <param name="data">
        /// 提交数据
        /// </param>
        /// <returns>
        /// 操作结果
        /// </returns>
        bool UpdateSubmitData(Guid identity, Dictionary<string, object> data);
    }
}
